<?php

/**
 * Password form.
 *
 * @package    dylemat
 * @subpackage form
 * @author     Your name here
 */
class PasswordForm extends sfForm
{
  public function configure()
  {
	
	$this->setWidgets(array(
      'oldpassword'   => new sfWidgetFormInputPassword(),
      'newpassword1' => new sfWidgetFormInputPassword(),
	  'newpassword2' => new sfWidgetFormInputPassword(),
    ));
	
    $this->setValidators(array(
      'oldpassword'   => new sfValidatorString(array('required' => true),array('required'=>'Należy podać stare hasło')),
	  'newpassword1' => new sfValidatorAnd(array(
				new sfValidatorString(array('required' => true)),
				new sfValidatorRegex(array('pattern' => '/^[0-9A-Za-z_.-]+$/'),array('invalid'=>'Dozwolone znaki to: a-zA-Z0-9_-.'))
			),array(),array('required'=>'Należy podać nowe hasło')),
	  'newpassword2' => new sfValidatorAnd(array(
				new sfValidatorString(array('required' => true)),
				new sfValidatorRegex(array('pattern' => '/^[0-9A-Za-z_.-]+$/'),array('invalid'=>'Dozwolone znaki to: a-zA-Z0-9_-.'))
			),array(),array('required'=>'Należy powtórzyć hasło'))
    ));
	
	$this->widgetSchema->setNameFormat('password[%s]');
  }
}